package com.sam.designpattern.builder;

/**
 * @Author: Sam
 * @Date: 2022-07-25 11:35
 * @Description: 认证配置类生成器对象
 */
public class AuthConfigBuilder {
    private String appId;

    private String secret;

    private long expireTime;

    public AuthConfigBuilder(String appId, String secret, long expireTime) {
        this.appId = appId;
        this.secret = secret;
        this.expireTime = expireTime;
    }

    public AuthConfigBuilder setAppId(String appId) {
        this.appId = appId;
        return this;
    }

    public AuthConfigBuilder setSecret(String secret) {
        this.secret = secret;
        return this;
    }

    public AuthConfigBuilder setExpireTime(long expireTime) {
        this.expireTime = expireTime;
        return this;
    }

    public AuthConfig build() {
        System.out.println("AuthConfig通过AuthConfigBuilder进行创建");
        return new AuthConfig(this);
    }

    public String getAppId() {
        return appId;
    }

    public String getSecret() {
        return secret;
    }

    public long getExpireTime() {
        return expireTime;
    }
}
